package oa.game;

import java.io.Closeable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level;
import java.util.logging.Logger;

public class MyUtils {

    private static final Logger logger = Logger.getLogger(MyUtils.class.getName());

    public static void silentClose(Closeable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (Exception ex) {
                logger.log(Level.SEVERE, "Could not close input", ex);
            }
        }
    }

    public static void silentClose(ResultSet rs) {
        if (rs != null) {
            try {
                rs.close();
            } catch (Exception ex) {
                logger.log(Level.SEVERE, "Could not close input", ex);
            }
        }
    }

    public static void silentClose(PreparedStatement statement) {
        if (statement != null) {
            try {
                statement.close();
            } catch (Exception ex) {
                logger.log(Level.SEVERE, "Could not close input", ex);
            }
        }
    }

    public static void silentClose(Connection conn) {
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception ex) {
                logger.log(Level.SEVERE, "Could not close input", ex);
            }
        }
    }
}
